define(['jquery','pages/index/model'],function($,model){
	var isInit=false;
	return {
		buy:function(code,type){
	    	if(code){
//	    	   location.href="/index.php/order/create?goodscode="+code+'&direct='+type;
	    	   location.href='#/order/create/'+code+'/'+type;
	    	}else{
	    		msg('先选择商品！');
	    	}
	    },
	    event:function(){
	    	var that=this;
	    	if(!isInit){
	    	   $('#buy-up,#buy-down').on('click',function(){
		    		var id=$(this).attr('id'),
		    		    code=model.code;
		    		that.buy(code,id=='buy-up'?'b':'s');
	    	  })
	    	  isInit=true;
	    	}
	    	
	    }
	}
});